package com.itheima.zixi2.ZuoYe;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public final class ChangeTime {
    public final static String ttos(LocalDateTime time) {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH时mm分ss秒");
        String c1 = dtf.format(time);
        return c1;
    }

    public final static String ttos(LocalDate time) {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
        String c1 = dtf.format(time);
        return c1;
    }

    public final static String ttos(LocalTime time) {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH时mm分ss秒");
        String c1 = dtf.format(time);
        return c1;
    }

    public final static LocalDateTime stot(String time) {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy年MM月dd日 HH时mm分ss秒");
            LocalDateTime c1 = LocalDateTime.parse(time, dtf);
            return c1;
    }
    public final static LocalDate stot2(String time) {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
        LocalDate c1 = LocalDate.parse(time, dtf);
        return c1;
    }
    public final static LocalTime stot3(String time) {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH时mm分ss秒");
        LocalTime c1 = LocalTime.parse(time, dtf);
        return c1;
    }
}
